home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SCREEN
/
CURSES01
/
minix
/
c
/
charins
< prev
next >
Wrap
Text File
|
1991-05-05
|
3KB
|
95 lines
/****************************************************************/
/* Winsch() routine of the PCcurses package */
/* */
/****************************************************************/
/* This version of curses is based on ncurses, a curses version */
/* originally written by Pavel Curtis at Cornell University. */
/* I have made substantial changes to make it run on IBM PC's, */
/* and therefore consider myself free to make it public domain. */
/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
/****************************************************************/
/* 1.0: Release: 870515 */
/****************************************************************/
/* Modified to run under the MINIX operating system by Don Cope */
/* These changes are also released into the public domain. */
/* 900906 */
/****************************************************************/
#include <curses.h>
#include "curspriv.h"
/****************************************************************/
/* Winsch() inserts character 'c' at the cursor position in */
/* window 'win'. The cursor is advanced. */
/****************************************************************/
int winsch(win, c)
WINDOW *win;
char c;
{
int *temp1;
int *temp2;
int *end;
int x = win->_curx;
int y = win->_cury;
int maxx = win->_maxx;
if((c < ' ') && (c == '\n' || c == '\r' || c == '\t' || c == '\b'))
return(waddch(win, c));
end = &win->_line[y][x];
temp1 = &win->_line[y][maxx];
temp2 = temp1 - 1;
if(c < ' ') /* if CTRL-char make space for 2 */
temp2--;
while (temp1 > end)
*temp1-- = *temp2--;
win->_maxchng[y] = maxx;
if ((win->_minchng[y] == _NO_CHANGE) || (win->_minchng[y] > x))
win->_minchng[y] = x;
return(waddch(win, c)); /* fixes CTRL-chars too */
} /* winsch */
/****************************************************************/
/* Insch() inserts character 'c' at the cursor position in */
/* stdscr. The cursor is advanced. */
/****************************************************************/
int insch(c)
char c;
{
return(winsch(stdscr,c));
} /* insch */
/****************************************************************/
/* Mvinsch() moves the stdscr cursor to a new position, then */
/* inserts character 'c' at the cursor position in stdscr. The */
/* cursor is advanced. */
/****************************************************************/
int mvinsch(y,x,c)
int y;
int x;
char c;
{
if (wmove(stdscr,y,x) == ERR)
return(ERR);
return(winsch(stdscr,c));
} /* mvinsch */
/****************************************************************/
/* Mvwinsch() moves the cursor of window 'win' to a new posi- */
/* tion, then inserts character 'c' at the cursor position in */
/* window 'win'. The cursor is advanced. */
/****************************************************************/
int mvwinsch(win,y,x,c)
WINDOW *win;
int y;
int x;
char c;
{
if (wmove(win,y,x) == ERR)
return(ERR);
return(winsch(win,c));
} /* mvwinsch */